/*
 * Copyright (c) 2016. zhaojin 15398699939@163.com
 */

package com.bankscene.screenfit.vus;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bankscene.screenfit.R;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindString;
import butterknife.ButterKnife;

/**
 * Created by jiiiiiin on 6/15/16.
 */
public class IdAuthenticationVu extends BaseVu {

    @BindString(R.string.base64StrTop)
    String base64StrTop;

    @BindString(R.string.base64StrDown)
    String base64StrDown;

    @Override
    public void init(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable EventBus bus) {
        this.bus = bus;
        rootView = inflater.inflate(R.layout.idauthentication_fragment, container, false);
        unbinder = ButterKnife.bind(this, rootView);
        byte[] byteTop = Base64.decode(base64StrTop, Base64.DEFAULT);
        Bitmap bitmapTop = BitmapFactory.decodeByteArray(byteTop, 0, byteTop.length);
        byte[] byteDown = Base64.decode(base64StrDown, Base64.DEFAULT);
        Bitmap bitmapDown = BitmapFactory.decodeByteArray(byteDown, 0, byteDown.length);
        ImageView frontView = (ImageView) rootView.findViewById(R.id.idAuthenImageView1);
        frontView.setImageBitmap(bitmapTop);
        ImageView backView = (ImageView) rootView.findViewById(R.id.idAuthenImageView2);
        backView.setImageBitmap(bitmapDown);
    }
}
